'''[bug]'''
def method(n, k, nums: list):
    if k == 1: return 0
    s = sum(nums)
    yu = s % k 
    color = 1
    nums.sort(reverse=True)
    for x in nums:
        if x > yu: break 
        yu -= x 
        color += 1 
    color = min(color, n)
    return color 

if __name__ == '__main__':
    n, k = [int(x) for x in input().split()]
    nums = [int(x) for x in input().split()]
    ans = method(n, k, nums)
    print(ans)
